lexer grammar Analex;
 
options {
  language = Java;
}

tokens {
  LIT_REAL;
  LIT_ENTERO;
}

@lexer::header {
  package Practica5.Flex;
}
   
fragment SALTO_LINEA:  ('\r' '\n' | '\r' | '\n');
fragment DIGITO: '0'..'9';
fragment LETRA: 'A'..'Z' | 'a'..'z' | '_' | '.';

DATO_TIPO 
    :   'boolean'
    |   'char'
    |   'byte'
    |   'short'
    |   'int'
    |   'long'
    |   'float'
    |   'double'
    ;

 
KEYWORD_VOID
  : 'void'
  ;
  
KEYWORD_RETURN
  : 'return'
  ;
  
KEYWORD_INCLUDE
  : 'include'
  ; 
   
COMENTARIO_LINEA: '//' (options { greedy=false;}:.)* SALTO_LINEA {skip();};
COMENTARIO_BLOQUE: '/*' ( options {greedy=false;} : . )* '*/' {skip();};
BLANCO: (' ' | '\t' | SALTO_LINEA) {skip();};
NUMERO: (DIGITO)+('.'(DIGITO)+)?;
ID: (OP_MULT)? LETRA (LETRA | DIGITO | OP_SUB)* (LEFT_BRACKET (DIGITO)* RIGHT_BRACKET)?; 
STRING: '\"' (options { greedy=false; }:.)* '\"';
LEFT_VERBATIM: PERCENTAJE LEFT_BRACE;
RIGHT_VERBATIM: PERCENTAJE RIGHT_BRACE;
SECTION: PERCENTAJE PERCENTAJE;
MACRONAME: LEFT_BRACE ID RIGHT_BRACE;
RANGO: LEFT_BRACKET (CARET)? ((LETRA|DIGITO) OP_SUB (LETRA|DIGITO))+ RIGHT_BRACKET;
REPEAT: LEFT_BRACE DIGITO (COMA|(COMA DIGITO))? RIGHT_BRACE;
     
OP_ASSIGN: '=';
OP_SUM: '+';
OP_SUB: '-';
OP_DIV: '/';
OP_MULT: '*';
OP_INC: '++';
OP_DEC: '--';
OP_MAI: '>=';
OP_MA: '>';
OP_MAE: '<=';
OP_ME: '<';
AMPERSAND: '&';
PIPE: '|';
LEFT_BRACE: '{';
RIGHT_BRACE: '}';
LEFT_PAREN: '(';
RIGHT_PAREN: ')';
LEFT_BRACKET: '[';
RIGHT_BRACKET: ']';
COMA: ',';
SEPARADOR: ';';
PERCENTAJE: '%';
CARET: '^';
QUESTIONMARK: '?';
ALMOHADILLA: '#';
